package com.softserveinc.lahire.configurator;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Configurator {

	private static Configurator instance;
	private HashMap<String, Object> options;
	public static HashMap<String, String> mimeType;
	public static HashMap<String, String> inner;

	private Configurator() {

		options = new HashMap<String, Object>();
		inner = new HashMap<String, String>();
		inner.put("login", "Admin");
		inner.put("pass", "admin");

		mimeType = new HashMap<String, String>() {

			{
				put("$3gp", "video/3gpp");
				put("$7z", "application/x-7z-compressed");
				put("abw", "application/x-abiword");
				put("ai", "application/postscript");
				put("aif", "audio/x-aiff");
				put("aifc", "audio/x-aiff");
				put("aiff", "audio/x-aiff");
				put("alc", "chemical/x-alchemy");
				put("art", "image/x-jg");
				put("asc", "text/plain");
				put("asf", "video/x-ms-asf");
				put("$asn", "chemical/x-ncbi-asn1");
				put("asn", "chemical/x-ncbi-asn1-spec");
				put("aso", "chemical/x-ncbi-asn1-binary");
				put("asx", "video/x-ms-asf");
				put("atom", "application/atom");
				put("atomcat", "application/atomcat+xml");
				put("atomsrv", "application/atomserv+xml");
				put("au", "audio/basic");
				put("avi", "video/x-msvideo");
				put("bak", "application/x-trash");
				put("bat", "application/x-msdos-program");
				put("b", "chemical/x-molconn-Z");
				put("bcpio", "application/x-bcpio");
				put("bib", "text/x-bibtex");
				put("bin", "application/octet-stream");
				put("bmp", "image/x-ms-bmp");
				put("book", "application/x-maker");
				put("boo", "text/x-boo");
				put("bsd", "chemical/x-crossfire");
				put("c3d", "chemical/x-chem3d");
				put("cab", "application/x-cab");
				put("cac", "chemical/x-cache");
				put("cache", "chemical/x-cache");
				put("cap", "application/cap");
				put("cascii", "chemical/x-cactvs-binary");
				put("cat", "application/vnd.ms-pki.seccat");
				put("cbin", "chemical/x-cactvs-binary");
				put("cbr", "application/x-cbr");
				put("cbz", "application/x-cbz");
				put("cc", "text/x-c++src");
				put("cdf", "application/x-cdf");
				put("cdr", "image/x-coreldraw");
				put("cdt", "image/x-coreldrawtemplate");
				put("cdx", "chemical/x-cdx");
				put("cdy", "application/vnd.cinderella");
				put("cef", "chemical/x-cxf");
				put("cer", "chemical/x-cerius");
				put("chm", "chemical/x-chemdraw");
				put("chrt", "application/x-kchart");
				put("cif", "chemical/x-cif");
				put("$class", "application/java-vm");
				put("cls", "text/x-tex");
				put("cmdf", "chemical/x-cmdf");
				put("cml", "chemical/x-cml");
				put("cod", "application/vnd.rim.cod");
				put("com", "application/x-msdos-program");
				put("cpa", "chemical/x-compass");
				put("cpio", "application/x-cpio");
				put("cpp", "text/x-c++src");
				put("$cpt", "application/mac-compactpro");
				put("cpt", "image/x-corelphotopaint");
				put("crl", "application/x-pkcs7-crl");
				put("crt", "application/x-x509-ca-cert");
				put("csf", "chemical/x-cache-csf");
				put("$csh", "application/x-csh");
				put("csh", "text/x-csh");
				put("csm", "chemical/x-csml");
				put("csml", "chemical/x-csml");
				put("css", "text/css");
				put("csv", "text/csv");
				put("ctab", "chemical/x-cactvs-binary");
				put("c", "text/x-csrc");
				put("ctx", "chemical/x-ctx");
				put("cu", "application/cu-seeme");
				put("cub", "chemical/x-gaussian-cube");
				put("cxf", "chemical/x-cxf");
				put("cxx", "text/x-c++src");
				put("dat", "chemical/x-mopac-input");
				put("dcr", "application/x-director");
				put("deb", "application/x-debian-package");
				put("diff", "text/x-diff");
				put("dif", "video/dv");
				put("dir", "application/x-director");
				put("djv", "image/vnd.djvu");
				put("djvu", "image/vnd.djvu");
				put("dll", "application/x-msdos-program");
				put("dl", "video/dl");
				put("dmg", "application/x-apple-diskimage");
				put("dms", "application/x-dms");
				put("doc", "application/msword");
				put("dot", "application/msword");
				put("d", "text/x-dsrc");
				put("dvi", "application/x-dvi");
				put("dv", "video/dv");
				put("dx", "chemical/x-jcamp-dx");
				put("dxr", "application/x-director");
				put("emb", "chemical/x-embl-dl-nucleotide");
				put("embl", "chemical/x-embl-dl-nucleotide");
				put("eml", "message/rfc822");
				put("$ent", "chemical/x-ncbi-asn1-ascii");
				put("ent", "chemical/x-pdb");
				put("eps", "application/postscript");
				put("etx", "text/x-setext");
				put("exe", "application/x-msdos-program");
				put("ez", "application/andrew-inset");
				put("fb", "application/x-maker");
				put("fbdoc", "application/x-maker");
				put("fch", "chemical/x-gaussian-checkpoint");
				put("fchk", "chemical/x-gaussian-checkpoint");
				put("fig", "application/x-xfig");
				put("flac", "application/x-flac");
				put("fli", "video/fli");
				put("fm", "application/x-maker");
				put("frame", "application/x-maker");
				put("frm", "application/x-maker");
				put("gal", "chemical/x-gaussian-log");
				put("gam", "chemical/x-gamess-input");
				put("gamin", "chemical/x-gamess-input");
				put("gau", "chemical/x-gaussian-input");
				put("gcd", "text/x-pcs-gcd");
				put("gcf", "application/x-graphing-calculator");
				put("gcg", "chemical/x-gcg8-sequence");
				put("gen", "chemical/x-genbank");
				put("gf", "application/x-tex-gf");
				put("gif", "image/gif");
				put("gjc", "chemical/x-gaussian-input");
				put("gjf", "chemical/x-gaussian-input");
				put("gl", "video/gl");
				put("gnumeric", "application/x-gnumeric");
				put("gpt", "chemical/x-mopac-graph");
				put("gsf", "application/x-font");
				put("gsm", "audio/x-gsm");
				put("gtar", "application/x-gtar");
				put("hdf", "application/x-hdf");
				put("hh", "text/x-c++hdr");
				put("hin", "chemical/x-hin");
				put("hpp", "text/x-c++hdr");
				put("hqx", "application/mac-binhex40");
				put("hs", "text/x-haskell");
				put("hta", "application/hta");
				put("htc", "text/x-component");
				put("$h", "text/x-chdr");
				put("html", "text/html");
				put("htm", "text/html");
				put("hxx", "text/x-c++hdr");
				put("ica", "application/x-ica");
				put("ice", "x-conference/x-cooltalk");
				put("ico", "image/x-icon");
				put("ics", "text/calendar");
				put("icz", "text/calendar");
				put("ief", "image/ief");
				put("iges", "model/iges");
				put("igs", "model/iges");
				put("iii", "application/x-iphone");
				put("inp", "chemical/x-gamess-input");
				put("ins", "application/x-internet-signup");
				put("iso", "application/x-iso9660-image");
				put("isp", "application/x-internet-signup");
				put("ist", "chemical/x-isostar");
				put("istr", "chemical/x-isostar");
				put("jad", "text/vnd.sun.j2me.app-descriptor");
				put("jar", "application/java-archive");
				put("java", "text/x-java");
				put("jdx", "chemical/x-jcamp-dx");
				put("jmz", "application/x-jmol");
				put("jng", "image/x-jng");
				put("jnlp", "application/x-java-jnlp-file");
				put("jpeg", "image/jpeg");
				put("jpe", "image/jpeg");
				put("jpg", "image/jpeg");
				put("js", "application/x-javascript");
				put("kar", "audio/midi");
				put("key", "application/pgp-keys");
				put("kil", "application/x-killustrator");
				put("kin", "chemical/x-kinemage");
				put("kml", "application/vnd.google-earth.kml+xml");
				put("kmz", "application/vnd.google-earth.kmz");
				put("kpr", "application/x-kpresenter");
				put("kpt", "application/x-kpresenter");
				put("ksp", "application/x-kspread");
				put("kwd", "application/x-kword");
				put("kwt", "application/x-kword");
				put("latex", "application/x-latex");
				put("lha", "application/x-lha");
				put("lhs", "text/x-literate-haskell");
				put("lsf", "video/x-la-asf");
				put("lsx", "video/x-la-asf");
				put("ltx", "text/x-tex");
				put("lyx", "application/x-lyx");
				put("lzh", "application/x-lzh");
				put("lzx", "application/x-lzx");
				put("$m3u", "audio/mpegurl");
				put("m3u", "audio/x-mpegurl");
				put("$m4a", "audio/mpeg");
				put("m4a", "video/mp4");
				put("m4b", "video/mp4");
				put("m4v", "video/mp4");
				put("maker", "application/x-maker");
				put("man", "application/x-troff-man");
				put("mcif", "chemical/x-mmcif");
				put("mcm", "chemical/x-macmolecule");
				put("mdb", "application/msaccess");
				put("me", "application/x-troff-me");
				put("mesh", "model/mesh");
				put("mid", "audio/midi");
				put("midi", "audio/midi");
				put("mif", "application/x-mif");
				put("mm", "application/x-freemind");
				put("mmd", "chemical/x-macromodel-input");
				put("mmf", "application/vnd.smaf");
				put("mml", "text/mathml");
				put("mmod", "chemical/x-macromodel-input");
				put("mng", "video/x-mng");
				put("moc", "text/x-moc");
				put("mol2", "chemical/x-mol2");
				put("mol", "chemical/x-mdl-molfile");
				put("moo", "chemical/x-mopac-out");
				put("mop", "chemical/x-mopac-input");
				put("mopcrt", "chemical/x-mopac-input");
				put("movie", "video/x-sgi-movie");
				put("mov", "video/quicktime");
				put("mp2", "audio/mpeg");
				put("mp3", "audio/mpeg");
				put("mp4", "video/mp4");
				put("mpc", "chemical/x-mopac-input");
				put("mpega", "audio/mpeg");
				put("mpeg", "video/mpeg");
				put("mpe", "video/mpeg");
				put("mpga", "audio/mpeg");
				put("mpg", "video/mpeg");
				put("ms", "application/x-troff-ms");
				put("msh", "model/mesh");
				put("msi", "application/x-msi");
				put("mvb", "chemical/x-mopac-vib");
				put("mxu", "video/vnd.mpegurl");
				put("nb", "application/mathematica");
				put("nc", "application/x-netcdf");
				put("nwc", "application/x-nwc");
				put("o", "application/x-object");
				put("oda", "application/oda");
				put("odb", "application/vnd.oasis.opendocument.database");
				put("odc", "application/vnd.oasis.opendocument.chart");
				put("odf", "application/vnd.oasis.opendocument.formula");
				put("odg", "application/vnd.oasis.opendocument.graphics");
				put("odi", "application/vnd.oasis.opendocument.image");
				put("odm", "application/vnd.oasis.opendocument.text-master");
				put("odp", "application/vnd.oasis.opendocument.presentation");
				put("ods", "application/vnd.oasis.opendocument.spreadsheet");
				put("odt", "application/vnd.oasis.opendocument.text");
				put("oga", "audio/ogg");
				put("ogg", "application/ogg");
				put("ogv", "video/ogg");
				put("ogx", "application/ogg");
				put("old", "application/x-trash");
				put("otg",
						"application/vnd.oasis.opendocument.graphics-template");
				put("oth", "application/vnd.oasis.opendocument.text-web");
				put("otp",
						"application/vnd.oasis.opendocument.presentation-template");
				put("ots",
						"application/vnd.oasis.opendocument.spreadsheet-template");
				put("ott", "application/vnd.oasis.opendocument.text-template");
				put("oza", "application/x-oz-application");
				put("p7r", "application/x-pkcs7-certreqresp");
				put("pac", "application/x-ns-proxy-autoconfig");
				put("pas", "text/x-pascal");
				put("patch", "text/x-diff");
				put("pat", "image/x-coreldrawpattern");
				put("pbm", "image/x-portable-bitmap");
				put("pcap", "application/cap");
				put("pcf", "application/x-font");
				put("pcf.Z", "application/x-font");
				put("pcx", "image/pcx");
				put("pdb", "chemical/x-pdb");
				put("pdf", "application/pdf");
				put("pfa", "application/x-font");
				put("pfb", "application/x-font");
				put("pgm", "image/x-portable-graymap");
				put("pgn", "application/x-chess-pgn");
				put("pgp", "application/pgp-signature");
				put("php3", "application/x-httpd-php3");
				put("php3p", "application/x-httpd-php3-preprocessed");
				put("php4", "application/x-httpd-php4");
				put("php", "application/x-httpd-php");
				put("phps", "application/x-httpd-php-source");
				put("pht", "application/x-httpd-php");
				put("phtml", "application/x-httpd-php");
				put("pk", "application/x-tex-pk");
				put("pls", "audio/x-scpls");
				put("pl", "text/x-perl");
				put("pm", "text/x-perl");
				put("png", "image/png");
				put("pnm", "image/x-portable-anymap");
				put("pot", "text/plain");
				put("ppm", "image/x-portable-pixmap");
				put("pps", "application/vnd.ms-powerpoint");
				put("ppt", "application/vnd.ms-powerpoint");
				put("prf", "application/pics-rules");
				put("prt", "chemical/x-ncbi-asn1-ascii");
				put("ps", "application/postscript");
				put("psd", "image/x-photoshop");
				put("p", "text/x-pascal");
				put("pyc", "application/x-python-code");
				put("pyo", "application/x-python-code");
				put("py", "text/x-python");
				put("qtl", "application/x-quicktimeplayer");
				put("qt", "video/quicktime");
				put("$ra", "audio/x-pn-realaudio");
				put("ra", "audio/x-realaudio");
				put("ram", "audio/x-pn-realaudio");
				put("rar", "application/rar");
				put("ras", "image/x-cmu-raster");
				put("rd", "chemical/x-mdl-rdfile");
				put("rdf", "application/rdf+xml");
				put("rgb", "image/x-rgb");
				put("rhtml", "application/x-httpd-eruby");
				put("rm", "audio/x-pn-realaudio");
				put("roff", "application/x-troff");
				put("ros", "chemical/x-rosdal");
				put("rpm", "application/x-redhat-package-manager");
				put("rss", "application/rss+xml");
				put("rtf", "application/rtf");
				put("rtx", "text/richtext");
				put("rxn", "chemical/x-mdl-rxnfile");
				put("sct", "text/scriptlet");
				put("sd2", "audio/x-sd2");
				put("sda", "application/vnd.stardivision.draw");
				put("sdc", "application/vnd.stardivision.calc");
				put("sd", "chemical/x-mdl-sdfile");
				put("sdd", "application/vnd.stardivision.impress");
				put("$sdf", "application/vnd.stardivision.math");
				put("sdf", "chemical/x-mdl-sdfile");
				put("sds", "application/vnd.stardivision.chart");
				put("sdw", "application/vnd.stardivision.writer");
				put("ser", "application/java-serialized-object");
				put("sgf", "application/x-go-sgf");
				put("sgl", "application/vnd.stardivision.writer-global");
				put("$sh", "application/x-sh");
				put("shar", "application/x-shar");
				put("sh", "text/x-sh");
				put("shtml", "text/html");
				put("sid", "audio/prs.sid");
				put("sik", "application/x-trash");
				put("silo", "model/mesh");
				put("sis", "application/vnd.symbian.install");
				put("sisx", "x-epoc/x-sisx-app");
				put("sit", "application/x-stuffit");
				put("sitx", "application/x-stuffit");
				put("skd", "application/x-koan");
				put("skm", "application/x-koan");
				put("skp", "application/x-koan");
				put("skt", "application/x-koan");
				put("smi", "application/smil");
				put("smil", "application/smil");
				put("snd", "audio/basic");
				put("spc", "chemical/x-galactic-spc");
				put("$spl", "application/futuresplash");
				put("spl", "application/x-futuresplash");
				put("spx", "audio/ogg");
				put("src", "application/x-wais-source");
				put("stc", "application/vnd.sun.xml.calc.template");
				put("std", "application/vnd.sun.xml.draw.template");
				put("sti", "application/vnd.sun.xml.impress.template");
				put("stl", "application/vnd.ms-pki.stl");
				put("stw", "application/vnd.sun.xml.writer.template");
				put("sty", "text/x-tex");
				put("sv4cpio", "application/x-sv4cpio");
				put("sv4crc", "application/x-sv4crc");
				put("svg", "image/svg+xml");
				put("svgz", "image/svg+xml");
				put("sw", "chemical/x-swissprot");
				put("swf", "application/x-shockwave-flash");
				put("swfl", "application/x-shockwave-flash");
				put("sxc", "application/vnd.sun.xml.calc");
				put("sxd", "application/vnd.sun.xml.draw");
				put("sxg", "application/vnd.sun.xml.writer.global");
				put("sxi", "application/vnd.sun.xml.impress");
				put("sxm", "application/vnd.sun.xml.math");
				put("sxw", "application/vnd.sun.xml.writer");
				put("t", "application/x-troff");
				put("tar", "application/x-tar");
				put("taz", "application/x-gtar");
				put("$tcl", "application/x-tcl");
				put("tcl", "text/x-tcl");
				put("texi", "application/x-texinfo");
				put("texinfo", "application/x-texinfo");
				put("tex", "text/x-tex");
				put("text", "text/plain");
				put("tgf", "chemical/x-mdl-tgf");
				put("tgz", "application/x-gtar");
				put("tiff", "image/tiff");
				put("tif", "image/tiff");
				put("tk", "text/x-tcl");
				put("tm", "text/texmacs");
				put("torrent", "application/x-bittorrent");
				put("tr", "application/x-troff");
				put("tsp", "application/dsptype");
				put("ts", "text/texmacs");
				put("tsv", "text/tab-separated-values");
				put("txt", "text/plain");
				put("udeb", "application/x-debian-package");
				put("uls", "text/iuls");
				put("ustar", "application/x-ustar");
				put("val", "chemical/x-ncbi-asn1-binary");
				put("vcd", "application/x-cdlink");
				put("vcf", "text/x-vcard");
				put("vcs", "text/x-vcalendar");
				put("vmd", "chemical/x-vmd");
				put("vms", "chemical/x-vamas-iso14976");
				put("$vrml", "model/vrml");
				put("vrml", "x-world/x-vrml");
				put("vrm", "x-world/x-vrml");
				put("vsd", "application/vnd.visio");
				put("wad", "application/x-doom");
				put("wav", "audio/x-wav");
				put("wax", "audio/x-ms-wax");
				put("wbmp", "image/vnd.wap.wbmp");
				put("wbxml", "application/vnd.wap.wbxml");
				put("wk", "application/x-123");
				put("wma", "audio/x-ms-wma");
				put("wmd", "application/x-ms-wmd");
				put("wmlc", "application/vnd.wap.wmlc");
				put("wmlsc", "application/vnd.wap.wmlscriptc");
				put("wmls", "text/vnd.wap.wmlscript");
				put("wml", "text/vnd.wap.wml");
				put("wm", "video/x-ms-wm");
				put("wmv", "video/x-ms-wmv");
				put("wmx", "video/x-ms-wmx");
				put("wmz", "application/x-ms-wmz");
				put("wp5", "application/wordperfect5.1");
				put("wpd", "application/wordperfect");
				put("$wrl", "model/vrml");
				put("wrl", "x-world/x-vrml");
				put("wsc", "text/scriptlet");
				put("wvx", "video/x-ms-wvx");
				put("wz", "application/x-wingz");
				put("xbm", "image/x-xbitmap");
				put("xcf", "application/x-xcf");
				put("xht", "application/xhtml+xml");
				put("xhtml", "application/xhtml+xml");
				put("xlb", "application/vnd.ms-excel");
				put("xls", "application/vnd.ms-excel");
				put("xlt", "application/vnd.ms-excel");
				put("xml", "application/xml");
				put("xpi", "application/x-xpinstall");
				put("xpm", "image/x-xpixmap");
				put("xsl", "application/xml");
				put("xtel", "chemical/x-xtel");
				put("xul", "application/vnd.mozilla.xul+xml");
				put("xwd", "image/x-xwindowdump");
				put("xyz", "chemical/x-xyz");
				put("zip", "application/zip");
				put("zmt", "chemical/x-mopac-input");

			}
		};

		// Add options entries

		options.put("tcpPort", 8080);
		options.put("udpPort", 13000);
		options.put("httpRoot", "C:\\webroot");
		options.put("connectionsMax", "150");
		options.put("threadsMax", "100");
		options.put("indexFile", "index.html");
		options.put("SessionsSuppport", true);
		options.put("redirectionUrl", "http://www.google.com");
		options.put("redirection", true);
		options.put("Users", inner);
		options.put("MIME types", mimeType);
		options.put("IPAddr", "0.0.0.0");
		options.put("directoryBrowsing", true);

	}

	public String getByTag(String tag) {
		return options.get(tag).toString();
	}

	public Object getObjectByTag(String tag) {
		return options.get(tag);
	}

	public HashMap<String, Object> getHashMap() {
		return options;
	}

	public Set<Map.Entry<String, Object>> getEntrySet() {

		return options.entrySet();
	}

	public void setHashMap(HashMap<String, Object> map) {

		options = map;
	}

	// Create a singleton instance for Configurator

	public static synchronized Configurator getInstance() {
		if (instance == null) {
			instance = new Configurator();
		}
		return instance;
	}

}
